<?php

namespace app\item\controller;

use app\common\model\Jumps;
use think\Controller;
use think\Request;

class Jump extends Controller
{

    public function index()
    {
        return view();
    }

    public function getdata()
    {
        $id = input('param.id', '');
        if ( !$id ) return '没有找到ID';

        $data = Jumps::where(['status'=>1, 'id'=>$id])->find();
        if ( !$data ) return '没有找到数据';

        $url = explode('||', $data['url']);

        $url = $url[mt_rand(0, count($url)-1)];

        return json(array('status'=>200, 'url'=>$url));
    }


}